/*
day450 
2020.11.20 
*/

#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int smallestRangeI(vector<int>& A, int K) {
		int max_A=A[0],min_A=A[0];
		for(int i=1;i<A.size();++i)
		{
			max_A=max(max_A,A[i]);
			min_A=min(min_A,A[i]);
		}
		
		int dif=max_A-min_A-K*2;
		return dif>0 ? dif : 0;
    }
};

int main()
{
	return 0;
 } 
